package com.leadingsoft.pwxk.converter;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

import com.leadingsoft.common.converter.AbstractConverter;
import com.leadingsoft.pwxk.dto.FileDetailDto;
import com.leadingsoft.pwxk.model.FileDetail;

@Component
public class FileDetailConverter extends AbstractConverter<FileDetail, FileDetailDto> {

	@Override
	protected FileDetailDto toDtoActual(FileDetail model) {
		FileDetailDto fileDetailDto = new FileDetailDto();
		BeanUtils.copyProperties(model, fileDetailDto);
		return fileDetailDto;
	}

	@Override
	public void copyProperties(FileDetail model, FileDetailDto dto) {

	}

	public List<FileDetailDto> toListDto(List<FileDetail> list) {
		List<FileDetailDto> dtos = new ArrayList<FileDetailDto>();
		list.forEach(t -> {
			dtos.add(toDtoActual(t));
		});
		return dtos;
	}

}
